 <%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html >
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="<%=request.getContextPath() %>/static/common/plugin/bootstrap-3.3.5/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
<link href="<%=request.getContextPath() %>/static/common/plugin/toastr/toastr.css" rel="stylesheet" type="text/css" /> <link href="<%=request.getContextPath() %>/static/common/css/style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="<%=request.getContextPath() %>/static/common/js/jquery.js"></script> 
<title>无标题文档</title>
</head>
<body>

	<div class="place">
    <span>位置：</span>
    <ul class="placeul">
    <li><a href="#">用户管理页面</a></li>
    </ul>
    </div>
    <div class="tools">  
     <ul class="toolbar">
        <li>
         <form id="conditionForm" action="<%=request.getContextPath() %>/SysServlet?command=listManageVerifyByPage" method="post">
					  名字：<input type="text" class="form-control" name="Name" value="${findSys.name }" style="width:150px ; display: inline"/> 
					  角色：<select name="role" class="form-control" style="width:100px ; display: inline">
								<option value="">-全部-</option>
								<option value="1" <c:if test="${findSys.role_id ==1 }">selected=selected</c:if>>学生</option>
								<option value="2" <c:if test="${findSys.role_id ==2 }">selected=selected</c:if>>老师</option>
					            <option value="3" <c:if test="${findSys.role_id ==3 }">selected=selected</c:if>>管理员</option>
							</select>
					<c:if test="${findSys.role_id ==1 }">
					  班级：<select name="class" class="form-control" style="width:100px ; display: inline">
								<option value="">-全部-</option>
								<option value="1" <c:if test="${findSys.class_id == 1 }">selected=selected</c:if>>1</option>
								<option value="2" <c:if test="${findSys.class_id == 2 }">selected=selected</c:if>>2</option>
							</select>
					</c:if>
					  状态：<select name="state" class="form-control" style="width:100px ; display: inline">
								<option value="">-全部-</option>
								<option value="1" <c:if test="${findSys.state == 1 }">selected=selected</c:if>>以启用</option>
								<option value="2" <c:if test="${findSys.state == 2 }">selected=selected</c:if>>以禁用</option>
							</select>
					<button class="btn btn-default">查询</button>
					
	    </form>
        </li>
        </ul>   
        <ul class="toolbar1">
        <li class="click"><a href="<%=request.getContextPath() %>/SysServlet?command=adduserPage" target="rightFrame"><span><img src="<%=request.getContextPath() %>/static/common/images/t01.png" /></span>添加用户</a></li>
        </ul>   
    </div>	
   <table border="1px" class="table">
   <thead>
		<tr>
			<th>编号</th>
			<th>帐号</th>
			<th>姓名</th>
			<th>性别</th>
			<th>电话</th>
			<th>邮箱</th>
			<th>创建时间</th>
			<th>所属角色</th>
			<th>所属班级</th>
			<th>状态</th>
			<th>备注</th>
			<th>操作</th>
		</tr>
	</thead>
	<tbody>
		<c:forEach items="${pageModel.list }" var="MangeMessage" varStatus="v">
			<tr>
				<td>${( pageModel.pageNo - 1 )* pageModel.pageSize + v.count }</td>
				<td>${MangeMessage.code }</td>
				<td>${MangeMessage.name}</td>
				<td>
					<c:if test="${MangeMessage.sex == 1 }">
						${MangeMessage.sexs }
					</c:if>
					<c:if test="${MangeMessage.sex != 1 }">
						${MangeMessage.sexs }
					</c:if>
				</td>
				<td>${MangeMessage.phone }</td>
				<td>${MangeMessage.email }</td>
				<td>${MangeMessage.create_time}</td>
			    <td>${MangeMessage.role_ids}</td> 
				<td>${MangeMessage.classname}</td>
				<td>
					<c:if test="${MangeMessage.state == 1 }">
						${MangeMessage.states }
					</c:if>
					<c:if test="${MangeMessage.state != 1 }">
						${MangeMessage.states }
					</c:if>
				</td>
				<td>${MangeMessage.memo}</td>			
				<td>
					<a href="<%=request.getContextPath()%>/SysServlet?command=getMessege&id=${MangeMessage.id}">修改</a>
					<a href="javascript:verify(${MangeMessage.state }, ${MangeMessage.id });">${MangeMessage.statess}</a>
					<a href="<%=request.getContextPath()%>/SysServlet?command=getPassword&id=${MangeMessage.id}"
					onclick="return confirm('是否修改？');">密码修改</a>					
				</td>
			</tr>
		</c:forEach>
		 <tr>
			<td colspan="12" align="right">
				<a href="<%=request.getContextPath()%>/SysServlet?command=listManageVerifyByPage&pageNo=${pageModel.first}">首页</a>&nbsp;
				<c:if test="${pageModel.pageNo > 1}">
				<a href="<%=request.getContextPath()%>/SysServlet?command=listManageVerifyByPage&pageNo=${pageModel.pre}">上一页</a>&nbsp;
				</c:if>
				第<select onchange="goPage(this)">
				 	<script>
				 		var pageNo = '${pageModel.pageNo }';
				 		var totalPage = '${pageModel.totalPage }';
				 		for (var i = 1; i <= totalPage; i++) {
				 			if (pageNo == i) {
				 				document.write('<option value="' + i + '" selected="selected">' + i + '</option>');
				 			} else {
				 				document.write('<option value="' + i + '">' + i + '</option>');
				 			}
				 		}
				 	</script>
				 </select>页
				,共${pageModel.totalPage }页&nbsp; 
				<c:if test="${pageModel.pageNo <  pageModel.totalPage }">
				<a href="<%=request.getContextPath()%>/SysServlet?command=listManageVerifyByPage&pageNo=${pageModel.next}">下一页</a>&nbsp;
				</c:if>
				<a href="<%=request.getContextPath()%>/SysServlet?command=listManageVerifyByPage&pageNo=${pageModel.last}">尾页</a>&nbsp;
				共${pageModel.allRecords }条记录
			</td>
		</tr> 
	</tbody>
</table>  
</body>


</html>
<script>
var tr = $('tr:gt(0)');
tr.click(function() {
	var preBackgroundColor = $(this).css('background-color');
	if (preBackgroundColor == 'rgb(18, 52, 86)') {
		$(this).css('background', 'gray');
	} else {
		$(this).css('background', 'rgba(0, 0, 0, 0)');
	}
}).mouseover(function() {
	 var preBackgroundColor = $(this).css('background-color');
	 if (preBackgroundColor != 'rgb(128, 128, 128)') {
	 	$(this).css('background', '#C0D9D9 48')
	 }
 }).mouseout(function(){
	 var preBackgroundColor = $(this).css('background-color');
	 if (preBackgroundColor != 'rgb(128, 128, 128)') {
		$(this).css('background', 'white')
	 }
 })
   /**
	 * 跳转到指定的页数
	 */
	function goPage(obj) {
		submitForm('<%=request.getContextPath()%>/SysServlet?command=listManageVerifyByPage&pageNo=' + obj.value);
	}
	
	/**
	 * 分页时，使用JS使用表单
	 */
	function submitForm(url) {
		var conditionForm = document.getElementById('conditionForm');
		conditionForm.action = url;
		conditionForm.submit();
	}
</script>
<script>
     /**
	 * change
	 */
	 function verify(state, id) {
    	 if (state ==1) {
    		 state =2;
		 }else{
			 state =1;
		 }
    	 location='<%=request.getContextPath()%>/SysServlet?command=change&status=' + state + '&Id='+id;	
}
</script>

